package com.xiweicheng.test.jpa.entity;
// Generated 2018-7-13 22:08:49 by Hibernate Tools 5.0.6.Final

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

/**
 * Blog generated by hbm2java
 */
@Entity
@Table(name = "blog", catalog = "tms")
public class Blog implements java.io.Serializable {

	private Long id;
	private long version;
	private Space space;
	private Users usersByUpdater;
	private Users usersByCreator;
	private String content;
	private Date createDate;
	private Boolean openEdit;
	private Boolean opened;
	private Boolean privated;
	private Long readCnt;
	private String status;
	private String title;
	private String type;
	private Date updateDate;
	private String voteCai;
	private Integer voteCaiCnt;
	private String voteZan;
	private Integer voteZanCnt;
	private Set<BlogHistory> blogHistories = new HashSet<BlogHistory>(0);
	private Set<Tag> tags = new HashSet<Tag>(0);
	private Set<BlogAuthority> blogAuthorities = new HashSet<BlogAuthority>(0);
	private Set<BlogFollower> blogFollowers = new HashSet<BlogFollower>(0);
	private Set<BlogStow> blogStows = new HashSet<BlogStow>(0);

	public Blog() {
	}

	public Blog(String status) {
		this.status = status;
	}

	public Blog(Space space, Users usersByUpdater, Users usersByCreator, String content, Date createDate,
			Boolean openEdit, Boolean opened, Boolean privated, Long readCnt, String status, String title, String type,
			Date updateDate, String voteCai, Integer voteCaiCnt, String voteZan, Integer voteZanCnt,
			Set<BlogHistory> blogHistories, Set<Tag> tags, Set<BlogAuthority> blogAuthorities,
			Set<BlogFollower> blogFollowers, Set<BlogStow> blogStows) {
		this.space = space;
		this.usersByUpdater = usersByUpdater;
		this.usersByCreator = usersByCreator;
		this.content = content;
		this.createDate = createDate;
		this.openEdit = openEdit;
		this.opened = opened;
		this.privated = privated;
		this.readCnt = readCnt;
		this.status = status;
		this.title = title;
		this.type = type;
		this.updateDate = updateDate;
		this.voteCai = voteCai;
		this.voteCaiCnt = voteCaiCnt;
		this.voteZan = voteZan;
		this.voteZanCnt = voteZanCnt;
		this.blogHistories = blogHistories;
		this.tags = tags;
		this.blogAuthorities = blogAuthorities;
		this.blogFollowers = blogFollowers;
		this.blogStows = blogStows;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)

	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Version
	@Column(name = "version", nullable = false)
	public long getVersion() {
		return this.version;
	}

	public void setVersion(long version) {
		this.version = version;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "space")
	public Space getSpace() {
		return this.space;
	}

	public void setSpace(Space space) {
		this.space = space;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "updater")
	public Users getUsersByUpdater() {
		return this.usersByUpdater;
	}

	public void setUsersByUpdater(Users usersByUpdater) {
		this.usersByUpdater = usersByUpdater;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "creator")
	public Users getUsersByCreator() {
		return this.usersByCreator;
	}

	public void setUsersByCreator(Users usersByCreator) {
		this.usersByCreator = usersByCreator;
	}

	@Column(name = "content")
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", length = 19)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "open_edit")
	public Boolean getOpenEdit() {
		return this.openEdit;
	}

	public void setOpenEdit(Boolean openEdit) {
		this.openEdit = openEdit;
	}

	@Column(name = "opened")
	public Boolean getOpened() {
		return this.opened;
	}

	public void setOpened(Boolean opened) {
		this.opened = opened;
	}

	@Column(name = "privated")
	public Boolean getPrivated() {
		return this.privated;
	}

	public void setPrivated(Boolean privated) {
		this.privated = privated;
	}

	@Column(name = "read_cnt")
	public Long getReadCnt() {
		return this.readCnt;
	}

	public void setReadCnt(Long readCnt) {
		this.readCnt = readCnt;
	}

	@Column(name = "status", nullable = false)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "title")
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "type")
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_date", length = 19)
	public Date getUpdateDate() {
		return this.updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	@Column(name = "vote_cai")
	public String getVoteCai() {
		return this.voteCai;
	}

	public void setVoteCai(String voteCai) {
		this.voteCai = voteCai;
	}

	@Column(name = "vote_cai_cnt")
	public Integer getVoteCaiCnt() {
		return this.voteCaiCnt;
	}

	public void setVoteCaiCnt(Integer voteCaiCnt) {
		this.voteCaiCnt = voteCaiCnt;
	}

	@Column(name = "vote_zan")
	public String getVoteZan() {
		return this.voteZan;
	}

	public void setVoteZan(String voteZan) {
		this.voteZan = voteZan;
	}

	@Column(name = "vote_zan_cnt")
	public Integer getVoteZanCnt() {
		return this.voteZanCnt;
	}

	public void setVoteZanCnt(Integer voteZanCnt) {
		this.voteZanCnt = voteZanCnt;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "blog")
	public Set<BlogHistory> getBlogHistories() {
		return this.blogHistories;
	}

	public void setBlogHistories(Set<BlogHistory> blogHistories) {
		this.blogHistories = blogHistories;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "tag_blog", catalog = "tms", joinColumns = {
			@JoinColumn(name = "blog_id", nullable = false, updatable = false) }, inverseJoinColumns = {
					@JoinColumn(name = "tag_id", nullable = false, updatable = false) })
	public Set<Tag> getTags() {
		return this.tags;
	}

	public void setTags(Set<Tag> tags) {
		this.tags = tags;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "blog")
	public Set<BlogAuthority> getBlogAuthorities() {
		return this.blogAuthorities;
	}

	public void setBlogAuthorities(Set<BlogAuthority> blogAuthorities) {
		this.blogAuthorities = blogAuthorities;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "blog")
	public Set<BlogFollower> getBlogFollowers() {
		return this.blogFollowers;
	}

	public void setBlogFollowers(Set<BlogFollower> blogFollowers) {
		this.blogFollowers = blogFollowers;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "blog")
	public Set<BlogStow> getBlogStows() {
		return this.blogStows;
	}

	public void setBlogStows(Set<BlogStow> blogStows) {
		this.blogStows = blogStows;
	}

}
